home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 217 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: jsa@edg.com (J. Stephen Adamczyk)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: inconsistance in over.over
  5. Date: 01 Feb 1996 09:22:45 PST
  6. Organization: Edison Design Group Inc.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <DM3LI3.EJ1@edg.com>
  9. References: <4eo2mk$7tc@boy.nmd.msu.ru>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Thu, 1 Feb 1996 13:01:15 GMT
  12. Apparently-To: comp-std-c++@uunet.uu.net
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMRD2+Ey4NqrwXLNJAQFRqQIAmKowypwOGHGyMUkW9Vaz5uDufzlI/9M6
  15.     FAz+II65Koc0pZywBXYtoy5EAInOERGqbYQFf4TpJKfPR0d/dEjEyg==
  16.     =wmUS
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. In article <4eo2mk$7tc@boy.nmd.msu.ru> krotoff@such.srcc.msu.su (Alexander Krotoff) writes:
  20. >There is small inconsistance in the Oct 95 WP:
  21. >-----------------------------------------------------------------------
  22. >13.4    Address of overloaded function    [over.over]
  23. >In the example on the end of the section:
  24. >
  25. >    int (X::*p5)(int)  = &(X::f);    // error: wrong syntax for</B>
  26. >                    // pointer to member</B>
  27. >    int    (*p6)(long) = &(X::f);    // OK</B>1
  28. >
  29. >Error: qualified-id enclosed in parentheses.
  30. >-----------------------------------------------------------------------
  31. >5.3.1    Unary operators            [expr.unary.op]
  32. >
  33. >3    A pointer to member is only formed when an explicit & is used and
  34. >    its operand is a qualified-id not enclosed in parentheses.
  35. >-----------------------------------------------------------------------
  36. >
  37. >I suppose the error is in the over.over.
  38.  
  39. Why do you think there's an error?  The point of the example in over.over
  40. is that something like X::f can represent a set of overloaded functions,
  41. some of which are nonstatic member functions and some of which are static
  42. member functions.  That set is subjected to overload resolution, and one
  43. of the functions is chosen.  If the one chosen is a nonstatic member function,
  44. then the form used must be &X::f.  But if the one chosen is a static
  45. member function, the form can be X::f or &X::f or &(X::f) etc., because
  46. any of those is a valid form for the address of a static member function.
  47.  
  48. Steve Adamczyk
  49. Edison Design Group
  50. ---
  51. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  52.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  53.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  54.